In [17]:
from ht import *
import matplotlib.pyplot as plt
from math import *
% matplotlib inline
import numpy as np
from scipy.interpolate import *
In [16]:
%timeit Ft_aircooler(Thi=125., Tho=45., Tci=25., Tco=95., Ntp=1, rows=4)
In [3]:
%timeit Rohsenow(Te=4.9, Cpl=4217., kl=0.680, mul=2.79E-4, sigma=0.0589, Hvap=2.257E6, rhol=957.854, rhog=0.595593, Csf=0.011, n=1.26)*4.9
In [4]:
%timeit Stephan_Abdelsalam(Te=16.2, Tsat=437.5, Cpl=2730., kl=0.086, mul=156E-6, sigma=0.0082, Hvap=272E3, rhol=567, rhog=18.09, angle=35, correlation='hydrocarbon')
In [5]:
%timeit Serth_HEDH(D=0.0127, sigma=8.2E-3, Hvap=272E3, rhol=567, rhog=18.09)
In [6]:
%timeit Nusselt_laminar(Tsat=370, Tw=350, rhog=7.0, rhol=585., kl=0.091, mul=158.9E-6, Hvap=776900, L=0.1)
In [7]:
%timeit Boyko_Kruzhilin(m=100, rhog=6.36, rhol=582.9, kl=0.098, mul=159E-6, Cpl=2520., D=0.03, x=0.85)
In [8]:
%timeit S_isothermal_pipe_eccentric_to_isothermal_pipe(.1, .4, .05, 10)
In [9]:
%timeit Nu_cylinder_Zukauskas(7992, 0.707, 0.69)
In [10]:
%timeit Nu_cylinder_Whitaker(6071, 0.7)
In [11]:
%timeit Nu_vertical_cylinder(0.72, 1E7, Method='McAdams, Weiss & Saunders')
%timeit Nu_vertical_cylinder(0.72, 1E7)
In [12]:
%timeit Nu_horizontal_cylinder(0.72, 1E7)
%timeit Nu_horizontal_cylinder(0.72, 1E7, Method='Morgan')
%timeit Nu_horizontal_cylinder(0.72, 1E7, Method='Churchill-Chu')
In [13]:
%timeit laminar_T_const()
%timeit 3.66
In [14]:
%timeit Nu_conv_internal(Re=1E5, Pr=1.2, fd=0.0185, eD=1E-3)
%timeit Nu_conv_internal(Re=1E5, Pr=1.2, fd=0.0185, eD=1E-3, AvailableMethods=True)
print Nu_conv_internal(Re=1E5, Pr=1.2, fd=0.0185, eD=1E-3, AvailableMethods=True)
In [15]:
%timeit Lehrer(m=2.5, Dtank=0.6, Djacket=0.65, H=0.6, Dinlet=0.025, dT=20., rho=995.7, Cp=4178.1, k=0.615, mu=798E-6, muw=355E-6)
%timeit Lehrer(m=2.5, Dtank=0.6, Djacket=0.65, H=0.6, Dinlet=0.025, dT=20., rho=995.7, Cp=4178.1, k=0.615, mu=798E-6, muw=355E-6, inlettype='radial', isobaric_expansion=0.000303)
In [16]:
%timeit Nu_packed_bed_Gnielinski(dp=8E-4, voidage=0.4, vs=1, rho=1E3, mu=1E-3, Pr=0.7)
In [17]:
%timeit dP_Kern(m=11., rho=995., mu=0.000803, mu_w=0.000657, DShell=0.584, LSpacing=0.1524, pitch=0.0254, Do=.019, NBaffles=22)
%timeit dP_Zukauskas(Re=13943., n=7, ST=0.0313, SL=0.0343, D=0.0164, rho=1.217, Vmax=12.6)
%timeit dP_Zukauskas(Re=13943., n=7, ST=0.0313, SL=0.0313, D=0.0164, rho=1.217, Vmax=12.6)
In [18]:
%timeit LMTD(100., 60., 30., 40.2)
%timeit LMTD(100., 60., 30., 40.2, counterflow=False)
In [21]:
%timeit [[Ntubes_Perrys(DBundle=1.184, Ntp=i, do=.028, angle=j) for i in [1,2,4,6]] for j in [30, 45, 60, 90]]
%timeit [[Ntubes_VDI(DBundle=1.184, Ntp=i, do=.028, pitch=.036, angle=j) for i in [1,2,4,8]] for j in [30, 45, 60, 90]]
%timeit [Ntubes_Phadkeb(DBundle=1.200-.008*2, do=.028, pitch=.036, Ntp=i, angle=45.) for i in [1,2,4,6,8]]
In [2]:
from ht.insulation import ASHRAE_k, ASHRAE, materials_dict
%timeit [ASHRAE_k(ID) for ID in ASHRAE]
print len(ASHRAE)
In [13]:
a = 'Bitumen'
print nearest_material(a)
%timeit nearest_material(a)
In [15]:
%timeit blackbody_spectral_radiance(800., 4E-6)
%timeit q_rad(.85, 400, 305.)
Conclusion: From 30 ms to 100 ns, not that wide of a range; only 5 orders of magnitude. String matching is definitely slow, which I know. Definitely menu-driven selection is prefered. Some complicated functions take a decently long time to work, also not a surprise. A better alternative to inter1d and interp2d exists; and is equally easy to use. As a bonus, it provides a degree of smoothing and more control. The overhead of dealing with strings is not large, but it may still be worth moving out in favor of dictionary comparisons. By and large, the library is still quick, for Python anyway.